#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    webView_debug = new GMap(ui->centralWidget);
    webView_debug->setObjectName(QString::fromUtf8("webView_debug"));
    webView_debug->setGeometry(QRect(10, -10, 581, 271));
    webView_debug->setUrl(QUrl("file:///home/student/qt/temp/run-performance/invest/gmaps1/sm4.html"));
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::changeEvent(QEvent *e)
{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::on_pushButton_debug_clicked()
{
    //ui->webView_debug->toJavaScript(QString ("map.panTo(new GLatLng(57.984261983475534, 102.87906646728516));"));
    //ui->webView_debug->toJavaScript(QString ("var marker = new google.maps.Marker({ position: new google.maps.LatLng(49.82438113, 24.05064789), map: map, title:\"GPS!\"});"));



    /*webView_debug->addPoint(QPointF(49.82438113, 24.05064789));
    webView_debug->addPoint(QPointF(49.82438113, 24.05364899));
    webView_debug->addPoint(QPointF(49.82238123, 24.05064789));
    webView_debug->addPoint(QPointF(49.82438113, 24.05064789));*/

    webView_debug->setZoom(40);
    webView_debug->setCenter(QPointF(49.84474877, 24.00118069));
    webView_debug->addPoint(QPointF(49.84474877, 24.00118069));
    webView_debug->addPoint(QPointF(49.84433524, 24.00083322));
    webView_debug->addPoint(QPointF(49.8445563, 24.00005136));
    webView_debug->addPoint(QPointF(49.8447406, 24.00002597));
    webView_debug->addPoint(QPointF(49.84474877, 24.00118069));
    //webView_debug->delPoint();

    webView_debug->addPolyline();

    //ui->webView_debug->toJavaScript("addPoint(new google.maps.LatLng(49.82438113, 24.05064789))");
    //ui->webView_debug->toJavaScript("addPoint(new google.maps.LatLng(49.82438113, 24.05364899))");
    //ui->webView_debug->toJavaScript("addPoint(new google.maps.LatLng(49.82238123, 24.05064789))");
    //ui->webView_debug->toJavaScript("addPoint(new google.maps.LatLng(49.82438113, 24.05064789))");

}
